﻿using Common.Enums;
using Wallpaper.Models.Interfaces;

namespace Wallpaper.Models.Entities
{

    /// <summary>
    /// 壁纸实体
    /// </summary>
    public class Wallpapers : BaseEntity,IHasTimestamps, ISoftDelete
    {

        /// <summary>
        /// 壁纸标题
        /// </summary>
        public string Title { get; set; }

        /// <summary>
        /// 壁纸文件URL（原图地址）
        /// </summary>
        public string FileUrl { get; set; }

        /// <summary>
        /// 缩略图URL（用于列表展示）
        /// </summary>
        public string ThumbnailUrl { get; set; }

        /// <summary>
        /// 上传人ID（关联用户或管理员）
        /// </summary>
        public string UploaderId { get; set; }

        /// <summary>
        /// 分类ID（关联分类表）
        /// </summary>
        public string CategoryId { get; set; }

        /// <summary>
        /// 上传人类型：0-用户，1-管理员（用于多态关联）
        /// </summary>
        public UploaderType UploaderType { get; set; }

        /// <summary>
        /// 壁纸宽度（像素）
        /// </summary>
        public int Width { get; set; }


        /// <summary>
        /// 是否上架
        /// </summary>
        public bool IsEnabled { get; set; }

        /// <summary>
        /// 壁纸高度（像素）
        /// </summary>
        public int Height { get; set; }

        /// <summary>
        /// 审核状态：0 待审核 1 审核通过 2未通过
        /// </summary>
        public WallpaperReviewStatus ReviewStatus { get; set; }


        /// <summary>
        /// 审核人Id
        /// </summary>
        public string ReviewerId { get; set; }

        /// <summary>
        /// 审核意见/理由（审核不通过时显示给用户）
        /// </summary>
        public string ReviewComment { get; set; }

        /// <summary>
        /// 审核时间
        /// </summary>
        public DateTime? ReviewedAt { get; set; }

        /// <summary>
        /// 创建时间（上传时间）
        /// </summary>
        public DateTime CreatedAt { get; set; }

        /// <summary>
        /// 最后更新时间
        /// </summary>
        public DateTime? UpdatedAt { get; set; }

        /// <summary>
        /// 软删除标志：true-已删除，false-正常
        /// </summary>
        public bool IsDeleted { get; set; }

        public virtual Category Category { get; set; }  // 这个就是 Include 要加载的关系

        public virtual ICollection<UserFavorite> UserFavorites { get; set; } = new List<UserFavorite>();
        public virtual ICollection<WallpaperTag> WallpaperTags { get; set; } = new List<WallpaperTag>();

        // 新增导航属性
        public virtual ICollection<DownloadRecord> DownloadRecords { get; set; } = new List<DownloadRecord>();
        public virtual ICollection<ViewRecord> ViewRecords { get; set; } = new List<ViewRecord>();
    }
}
